﻿// ==================================================================================================
// Copyright(C) 2018 FI Ltd. All rights reserved.
//
// SYSTEM NAME	    : FI.Net Application Framework
// COMPONENT ID	    : FI.Core
// COMPONENT DESC   : 
//
// CREATED DATE/BY  : 16 Nov 2011 / Tian Mi
//
// REVISION HISTORY :	
// DATE/BY			SR#/CS/PM#/OTHERS		DESCRIPTION OF CHANGE
// ==================================================================================================

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.Unity;

namespace FI.Core.IoC
{
   internal static class TypeExtensions
    {
        public static  bool IsTypeOfUnity(this Type type)
        {
            string token1 = Encoding.Default.GetString(type.Assembly.GetName().GetPublicKeyToken());
            string token2 = Encoding.Default.GetString(typeof(IUnityContainer).Assembly.GetName().GetPublicKeyToken());
            return token1 == token2;
        }

        public static bool IsTypeOfEntLib(this Type type)
        {
            string token1 = Encoding.Default.GetString(type.Assembly.GetName().GetPublicKeyToken());
            string token2 = Encoding.Default.GetString(typeof(SerializableConfigurationSection).Assembly.GetName().GetPublicKeyToken());
            return token1 == token2;
        }
    }
}
